//
//  MBProgressHUD+YSHUDManager.h
//  YSKitDemo
//
//  Created by Kyson on 2018/12/13.
//  Copyright © 2018 YangShen. All rights reserved.
//

#if __has_include(<MBProgressHUD/MBProgressHUD.h>)
#import <MBProgressHUD/MBProgressHUD.h>
#else
#import "MBProgressHUD.h"
#endif

typedef NS_ENUM(NSInteger, YSHUDContentStyle) {
    YSHUDContentStyleDefault = 0,   ///< 默认白底黑字
    YSHUDContentStyleBlack,         ///< 黑底白字
    YSHUDContentStyleCustom,        ///< 自定义
};

typedef NS_ENUM(NSInteger, YSHUDPosition) {
    YSHUDPositionCenter,            ///< 中间
    YSHUDPositionTop,               ///< 上面
    YSHUDPositionBottom,            ///< 下面
};

typedef NS_ENUM(NSInteger, YSHUDProgressStyle) {
    YSHUDProgressStyleDeterminate,              ///<  双圆环，进度环在内
    YSHUDProgressStyleDeterminateHorizontalBar, ///<  横向Bar的进度条
    YSHUDProgressStyleAnnularDeterminate,       ///<  双圆环，完全重合
    YSHUDProgressStyleCancelationDeterminate,   ///<  带取消按钮 - 双圆环 - 完全重合
};

// 默认持续显示时间(x秒后消失)
UIKIT_EXTERN CGFloat const delayTime;
#define YSDefaultHudStyle  1    // 黑底白字
/**
 风格为自定义时，在这里设置颜色
 */
#define YSCustomHudStyleBackgrandColor  [UIColor colorWithWhite:0.f alpha:0.7f]
#define YSCustomHudStyleContentColor    [UIColor colorWithWhite:1.f alpha:0.7f]

typedef void (^YSCurrentHUD)(MBProgressHUD *hud);

@interface MBProgressHUD (YSHUDManager)

/// 内容风格
@property (nonatomic, copy  , readonly) MBProgressHUD *(^hudContentStyle)(YSHUDContentStyle hudContentStyle);
/// 蒙层背景色
@property (nonatomic, copy  , readonly) MBProgressHUD *(^hudBackgroundColor)(UIColor *backgroundColor);
/// 内容背景色
@property (nonatomic, copy  , readonly) MBProgressHUD *(^bezelBackgroundColor)(UIColor *bezelBackgroundColor);
/// 显示位置
@property (nonatomic, copy  , readonly) MBProgressHUD *(^hudPosition)(YSHUDPosition hudPosition);
/// 标题颜色
@property (nonatomic, copy  , readonly) MBProgressHUD *(^titleColor)(UIColor *titleColor);

+ (void)hide;
+ (void)hideForView:(UIView *)view;

#pragma mark - 菊花
+ (void)show;
+ (void)showAfterDelay:(NSTimeInterval)delay;
+ (void)showInView:(UIView *)view;
+ (void)showInView:(UIView *)view afterDelay:(NSTimeInterval)delay;

+ (void)showWithTitle:(NSString *)title detail:(NSString *)detail;
+ (void)showWithTitle:(NSString *)title detail:(NSString *)detail afterDelay:(NSTimeInterval)delay;
+ (void)showWithTitle:(NSString *)title detail:(NSString *)detail inView:(UIView *)view;
+ (void)showWithTitle:(NSString *)title detail:(NSString *)detail inView:(UIView *)view afterDelay:(NSTimeInterval)delay;
+ (void)showWithTitle:(NSString *)title detail:(NSString *)detail inView:(UIView *)view afterDelay:(NSTimeInterval)delay configHUD:(YSCurrentHUD)configHUD;


#pragma mark - 提示: 文字+详情
/// 默认底部
+ (void)showTip:(NSString *)tip;
+ (void)showTip:(NSString *)tip position:(YSHUDPosition)position;
+ (void)showTip:(NSString *)tip position:(YSHUDPosition)position afterDelay:(NSTimeInterval)delay;
+ (void)showTip:(NSString *)tip detail:(NSString *)detail position:(YSHUDPosition)position afterDelay:(NSTimeInterval)delay;
+ (void)showTip:(NSString *)tip detail:(NSString *)detail position:(YSHUDPosition)position afterDelay:(NSTimeInterval)delay configHUD:(YSCurrentHUD)configHUD;

#pragma mark - 图片
+ (void)showImage:(UIImage *)image message:(NSString *)message;
+ (void)showImage:(UIImage *)image message:(NSString *)message afterDelay:(NSTimeInterval)delay;
+ (void)showImage:(UIImage *)image message:(NSString *)message afterDelay:(NSTimeInterval)delay configHUD:(YSCurrentHUD)configHUD;

+ (void)showImages:(NSArray<UIImage *> *)images message:(NSString *)message;
+ (void)showImages:(NSArray<UIImage *> *)images message:(NSString *)message afterDelay:(NSTimeInterval)delay;
+ (void)showImages:(NSArray<UIImage *> *)images showSize:(CGSize)size message:(NSString *)message;
+ (void)showImages:(NSArray<UIImage *> *)images showSize:(CGSize)size message:(NSString *)message afterDelay:(NSTimeInterval)delay;
+ (void)showImages:(NSArray<UIImage *> *)images showSize:(CGSize)size message:(NSString *)message afterDelay:(NSTimeInterval)delay configHUD:(YSCurrentHUD)configHUD;

+ (void)showGif:(UIImage *)gifImage message:(NSString *)message afterDelay:(NSTimeInterval)delay;
+ (void)showGif:(UIImage *)gifImage message:(NSString *)message afterDelay:(NSTimeInterval)delay configHUD:(YSCurrentHUD)configHUD;

#pragma mark - Data -> Gif
+ (UIImage *)imageGIFWithData:(NSData *)data;

@end
